Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
Calling method on primitive string? "string".length why this is possible although string is not an object

Javascript has 7 primitive values as string,number,bigint,boolean,undefined,symbol, null. What I don't understand they are not really objects when we declare them. And their type is not an object. And we can still call methods on strings. How is that possible?

When we create strings(str1 = "aysel" and check typeof is a string then if you check typeof string comes to function. But if I create str2= new String("aysel") Typeof str2 is obj. But we can call str1.length on primitive string too. Although we have never defined as an object on first place.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!